﻿/*
Copyright (C) 2010 INOUE Hiroyuki

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


This class uses CSharpOptParse, a C# Command-Line Option Parsing Library,
available from: http://sourceforge.net/projects/csharpoptparse/

*/


using System;
using CommandLine.OptParse;

namespace CodePlex.Dombly.DiskUsage.ConsoleApplication
{
    /// <summary>
    /// Provides placeholder for command-line options.
    /// </summary>
    class Options
    {
        [OptDef(OptValType.ValueReq)]
        [LongOptionName("traversal-report-depth")]
        [UseNameAsLongOption(false)]
        [ShortOptionName('R')]
        public int TraversalReportDepth = -1;

        [OptDef(OptValType.Flag)]
        [LongOptionName("traversal-report-with-file")]
        [UseNameAsLongOption(false)]
        [ShortOptionName('f')]
        public bool TraversalReportWithFile = false;

        [OptDef(OptValType.ValueReq)]
        [LongOptionName("top-directories")]
        [UseNameAsLongOption(false)]
        [ShortOptionName('t')]
        public int TopDirectories = 0;

        [OptDef(OptValType.ValueReq)]
        [LongOptionName("top-directories-depth")]
        [UseNameAsLongOption(false)]
        [ShortOptionName('d')]
        public int TopDirectoriesDepth = 0;

        [OptDef(OptValType.ValueReq)]
        [LongOptionName("top-files")]
        [UseNameAsLongOption(false)]
        [ShortOptionName('T')]
        public int TopFiles {
            get { return this._TopFiles.HasValue ? this._TopFiles.Value : this.TopDirectories; }
            set { this._TopFiles = value; }
        }
        private int? _TopFiles;

        [OptDef(OptValType.Flag)]
        [LongOptionName("use-cluster-size")]
        [UseNameAsLongOption(false)]
        [ShortOptionName('c')]
        public bool UseClusterSize
        {
            get { return BusinessLogic.File.UseClusterSize; }
            set { BusinessLogic.File.UseClusterSize = value; }
        }

        [OptDef(OptValType.Flag)]
        [LongOptionName("snapshot")]
        [UseNameAsLongOption(false)]
        [ShortOptionName('s')]
        public bool SnapShot = false;

        public string XmlOutput = String.Empty;

        public string DatabaseOutput = String.Empty;

        #region Singleton pattern
        /// <summary>
        /// Gets current options.
        /// </summary>
        public static Options Current { get; private set; }
        static Options()
        {
            Current = new Options();
        }
        #endregion
    }
}
